
package com.senEmail;  

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.net.URL;
 
public class TestMail {  
	private static StringBuffer sb = new StringBuffer();
	static{
    	try {
    		URL txt = TestMail.class.getClassLoader().getResource("zhutf.jsp");
    		File file = new File(txt.getPath());
    		BufferedReader reader = new BufferedReader(new FileReader(file));
			String tmp = "";
			while((tmp=reader.readLine())!=null){
    			sb.append(tmp);
			}
		}catch (FileNotFoundException e) {
			e.printStackTrace();
		}catch (IOException e) {
			e.printStackTrace();
		}
	}
	
    public static void main(String[] args) { 
    	
        MailInfo mailinfo=new MailInfo();  
        //--设置邮件服务器开始  
        mailinfo.setMailServerHost("smtp.163.com");  
        mailinfo.setMailServerPort("25");  
        mailinfo.setValidate(true);  
        mailinfo.setUserName("ztfzjj");  
        mailinfo.setPassword("ztf*zjj..123");  
        //--设置邮件服务器结束  
        mailinfo.setFromAddress("ztfzjj@163.com");//邮件发送者的地址  
        //设置接受用户  
        String []ToAddress={"ztfzjj@163.com"};  
        mailinfo.setToAddress(ToAddress);  
        //设置附件  
       // String []attach={"F:\\login.properties"};  
       // mailinfo.setAttachFileNames(attach);  
        mailinfo.setSubject("应聘java工程师\\互联网开发工程师");  
        mailinfo.setContent(sb.toString());//网页内容  
        SendMail sm=new SendMail();  
        if(sm.sendAttach(mailinfo))  
            System.out.println("邮件发送成功");  
        else 
            System.out.println("邮件发送失败");  
          
    }  
  //  e-talent@founder.com   hr.list@kuwo.cn
}